package com.xiaoyuan.controller;

import java.util.Map;

import com.xiaoyuan.dao.Student;
import com.xiaoyuan.minicore.ioc.annotation.Inject;
import com.xiaoyuan.minicore.mvc.bean.BaseAction;
import com.xiaoyuan.minicore.mvc.annotation.Request;
import com.xiaoyuan.minicore.mvc.bean.Result;
import com.xiaoyuan.service.StudentService;

/**
 * @Auther: xiaoyuan
 * @Date: 2020/4/28
 * @Description:
 */
public class HelloAction extends BaseAction {

    @Inject
    private StudentService studentService;

    @Request("GET:/product/{id}")
    public Result hello(Long id){
        Student student = studentService.getStudentById(id.intValue());
        return new Result(0,this.toString());
    }

    @Request("GET:/hello")
    public Result hello1(){
        System.out.println(Thread.currentThread().getName());
        int n = 0;
        try {
            n=studentService.insertStudent("xxxxyyyy","guanwo");
        }catch (Exception e){
            e.printStackTrace();
        }

        return new Result(0,n);
    }

}
